package com.aynu.admin.utils.redis;

import jakarta.annotation.Resource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class RedisDelete {
    @Resource
    private StringRedisTemplate stringRedisTemplate;
    public boolean deleteInfoAndKey(String startsWith,String accountId) {
        String key = startsWith.concat(accountId);
        System.out.println(key);
        String value = stringRedisTemplate.opsForValue().getAndDelete(key);
        System.out.println(value);
        if (value != null) {
            return stringRedisTemplate.delete(value);
        }
        return false;
    }
}
